package com.companion.companion.controller;

import java.util.List;

import com.companion.companion.domain.Serverorder;
import com.companion.companion.service.IServerorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 陪护服务订单Controller
 * 
 * @author zly
 * @date 2025-05-06
 */@CrossOrigin
@RestController
@RequestMapping("/system/serverorder")
public class ServerorderController
{
    @Autowired
    private IServerorderService serverorderService;

    /**
     * 查询陪护服务订单列表
     */
    @GetMapping("/list")
    public List<Serverorder> list(Serverorder serverorder)
    {
        return serverorderService.selectServerorderList(serverorder);
    }

    /**
     * 获取陪护服务订单详细信息
     */
    @GetMapping(value = "/{orderId}")
    public Serverorder getInfo(@PathVariable("orderId") Long orderId)
    {
        return serverorderService.selectServerorderByOrderId(orderId);
    }

    /**
     * 新增陪护服务订单
     */
    @PostMapping
    public int add(@RequestBody Serverorder serverorder)
    {
        return serverorderService.insertServerorder(serverorder);
    }

    /**
     * 修改陪护服务订单
     */
    @PutMapping
    public int edit(@RequestBody Serverorder serverorder)
    {
        return serverorderService.updateServerorder(serverorder);
    }

    /**
     * 删除陪护服务订单
     */
    @DeleteMapping("/{orderIds}")
    public int remove(@PathVariable Long[] orderIds)
    {
        return serverorderService.deleteServerorderByOrderIds(orderIds);
    }
}
